<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../bootstrap-5.1.3-dist/css/bootstrap.css">
    <script src="../bootstrap-5.1.3-dist/js/bootstrap.js"></script>
</head>

<body class="container">
    <h3 align="center">相对于父元素的宽度</h3>
    <div class="bg-light text-white mb-4">
        <div class="w-25 p-3 bg-success">w-25</div>
        <div class="w-50 p-3 bg-success">w-50</div>
        <div class="w-75 p-3 bg-success">w-75</div>
        <div class="w-100 p-3 bg-success">w-100</div>
        <div class="w-auto p-3 bg-success border-top">w-auto</div>
    </div>
    <h3 class="mb-2">相对于父元素的高度</h3>
    <div class="bg-light text-white" style="height: 100px;">
        <div class="h-25 d-inline-block bg-success text-center" style="width: 120px;">h-25</div>
        <div class="h-50 d-inline-block bg-success text-center" style="width: 120px;">h-50</div>
        <div class="h-75 d-inline-block bg-success text-center" style="width: 120px;">h-75</div>
        <div class="h-100 d-inline-block bg-success text-center" style="width: 120px;">h-100</div>
        <div class="h-auto d-inline-block bg-success text-center" style="width: 120px;">h-auto</div>
    </div>
</body>

</html>